<template>
  <div class="search">
    <input type="text" placeholder="请输入内容，按回车确认" v-model="username" @keyup.enter='huiche'>
  </div>
</template>

<script>
export default {
  data() {
    return {
      username: ''
    }
  },
  methods: {
    huiche() {
      this.$store.commit('jiaru', this.username)
      this.username = ''
    }
  }
}
</script>

<style lang='scss' scoped>
.search {
  width: 100%;
  height: 50px;
  background-color: aqua;
  display: flex;
  justify-content: center;
  align-items: center;

  input {
    width: 80%;
    height: 30px;
    outline: none;
    border-radius: 40px;
    border: 1px solid gray;
    text-align: center;
    color: gray;
  }
}
</style>